<template>
  <tr>
    <td>
      <span><input type="checkbox" v-model="list.checked" /></span>
    </td>
    <td>{{ list.name }}</td>
    <td>{{ list.price }}</td>
    <td>
      <input type="button" @click="subfn(index)" value="-" />
      <span>{{ list.num }}</span>
      <input type="button" @click="addfn(index)" value="+" />
    </td>
    <td>{{ list.num * list.price }}</td>
    <td><button @click="btn">删除</button></td>
  </tr>
</template>

<script>
export default {
  props: ["list", "index"],
  methods: {
    btn(index) {
      this.$emit("delfn", index);
    },
    addfn(index) {
      this.$emit("addfn", index);
    },
    subfn(index) {
      this.$emit("subfn", index);
    },
  },
};
</script>

<style scoped>
tr {
  text-align: center;
}
</style>>
